/**
 * 
 */
package xiaojian.toolkit.ebus.actors;

import xiaojian.toolkit.ebus.EventBus;
import xiaojian.toolkit.util.ClosureEx;

/**
 * @author hp
 * 
 */
public class AbstractEventActor {

	private EventBus ebus;
	
	private String name = null;

	/**
	 * @param ebus
	 *            the ebus to set
	 */
	public AbstractEventActor(EventBus ebus, final String name) {
		this.ebus = ebus;
		this.name = name;
	}

	protected Runnable registerObserver(String event, Object target,
			String methodName) {
		return ebus.registerObserver(event, target, methodName);
	}

	protected Runnable registerObserver(String event, ClosureEx closure) {
		return ebus.registerObserver(event, closure);
	}

	public void destroy() {
	}

	protected EventBus getEventBus() {
		return ebus;
	}
	
	public String toString() {
		return this.name;
	}
	
	public String getName() {
		return name;
	}
}
